package com.basics.channel.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.basics.api.request.channel.GroupChannelMemberReq;
import com.basics.api.request.organization.GroupOrganizationMemberReq;
import com.basics.api.response.organization.GroupOrganizationMemberListData;
import com.basics.api.response.organization.OrganizationMemberListData;
import com.basics.channel.entity.CyChannelGroupUser;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 频道用户绑定表 服务类
 * </p>
 *
 * @author WangWei
 * @since 2025-03-09
 */
public interface CyChannelGroupUserService extends IService<CyChannelGroupUser> {

    /**
     * 获取权限
     * @param channelId
     * @param userId
     * @return
     */
    CyChannelGroupUser getByChannelId(Long channelId, Long userId);

    /**
     * 根据分组ID获取成员数量
     * @param groupId
     * @return
     */
    int getMemberByGroupId(String groupId);

    /**
     * 创建频道下全部成员到频道
     * @param organizationId
     */
    void addAllUserByOrganizationId(Long organizationId,Long channelId);

    /**
     * 加入组织加入到组织下面的全部频道
     * @param organizationId
     * @param userId
     */
    void addAllChannelByOrganizationId(Long organizationId,Long userId);

    /**
     * 查询频道下分组成员
     * @param req
     * @return
     */
    IPage<GroupOrganizationMemberListData> selectChannelGroupMemberList(GroupChannelMemberReq req);

    /**
     * 获取分组成员数量
     * @param groupId
     * @return
     */
    long getGroupMemberNum(String groupId);

    /**
     * 获取频道下成员数量
     * @param channelId
     * @return
     */
    long getJoinMemberNum(Long channelId);

    /**
     * 查询分组成员
     * @param page
     * @param groupId
     * @return
     */
    IPage<OrganizationMemberListData> selectMemberListByGroupId(Page page,String groupId);
}
